package com.ruoyi.generator.service;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.generator.mapper.InspectionMapper;
import com.ruoyi.generator.mapper.SiteMapper;
import com.ruoyi.generator.po.Device;
import com.ruoyi.generator.po.DeviceFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SiteServiceImpl implements SiteService {


    @Autowired
    private SiteMapper siteMapper;


    @Override
    public int addSevice(Device device) {
        DeviceFile deviceFile = siteMapper.selectDeviceFile(device.getDeviceCode());
        device.setImageName(deviceFile.getFileName());
        device.setImagePath(deviceFile.getFilePath());
        return siteMapper.addSevice(device);
    }

    @Override
    public List<Device> selectDeviceList(Device device) {
        return siteMapper.selectDeviceList(device);
    }

    @Override
    public void addDeviceFile(DeviceFile deviceFile) {
                siteMapper.addDeviceFile(deviceFile);
    }
}
